/*
 * Copyright (c) 2012 Reksoft
 */
package org.sensice.matrioshka_alarm_clock

/**
 * @author Reksoft / Vasiliy Beglyanin
 *
 */
import android.os.Bundle
import android.view.View
import android.widget.TextView
import android.widget.Button
import android.app.Activity
import R._

class MainActivity extends Activity {
  lazy val textView = findViewById(R.id.textView1).asInstanceOf[TextView]
  lazy val button = findViewById(R.id.button1).asInstanceOf[Button]

  override def onCreate(savedInstanceState: Bundle) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    button.setOnClickListener((v: View) => textView.setText("Hello Scala"))
  }

  implicit def func2OnClickListener(func: (View) => Unit): View.OnClickListener = {
    new View.OnClickListener() {
      override def onClick(v: View) = func(v)
    }
  }

}